package org.jix.gbook.oss.biz.service.impl;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.jix.framework.common.response.Response;
import org.jix.gbook.oss.biz.service.FileService;
import org.jix.gbook.oss.biz.strategy.FileStrategy;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author stark
 * @date 2025/6/8 12:58
 * @description
 **/
@Service
@Slf4j
public class FileServiceImpl implements FileService {
    @Resource
    private FileStrategy fileStrategy;

    private static final String BUCKET_NAME = "gbook";

    @Override
    public Response<?> uploadFile(MultipartFile file) {

        //上传文件
        String url = fileStrategy.uploadFile(file, BUCKET_NAME);

        return Response.success(url);
    }
}
